<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <div>
        <tr>
            <td><input type="text" name="keyword" placeholder="请输入关键字"></td>
            <td><input type="button" value="查找" onclick="query()"></td>
            <td><input type="button" value="新增" onclick="add()"></td>
        </tr>
    </div>
    <table>
        <tr>
            <td>id</td>
            <td>标题</td>
            <td>摘要</td>
            <td>内容</td>
            <td>分类</td>
            <td>作者</td>
            <td>发表时间</td>
        </tr>
    </table>



    <script src="./js/jquery-3.6.0.min.js"></script>
    <script src="./config//baseUrl.js"></script>
    <script src="./js/api.js"></script>
    <script src="./js/init.js"></script>
    <script>

        // 添加
        function add() {
            location.href = 'createOrEdit.html'
        }
        //编辑
        function update(id) {
            location.href = `createOrEdit.html?id=${id}`
        }
        // 查找
        function query() {
            let keyword = $('[name=keyword]').val()
            getListWithKwyword(keyword)
        }
        // 删除
        function del(id) {
            if (confirm('确定删除?')) {
                delBlog(id).then(res => {
                    $(`[key=${res.data.id}]`).remove()
                })
            }

        }
    </script>
</body>

</html>